package com.test.kupi.fw;

import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;

public abstract class HelperBase {

	protected ApplicationManager manager;
	protected WebDriver driver;

	public HelperBase(ApplicationManager manager) {
		this.manager = manager;	
		this.driver = manager.driver;
	}
	
	public boolean isElementPresent(By by) {
	    try {
	      driver.findElement(by);
	      return true;
	    } catch (NoSuchElementException e) {
	      return false;
	    }
	}
	
	public void click(By linkText) {
		driver.findElement(linkText).click();
	}

	public void input(By linkText, String text) {
		driver.findElement(linkText).clear();
		driver.findElement(linkText).sendKeys(text);
	}

}	
